Explicit type conversion is performed using the cast operator. A value is "cast" to another type by prefixing it with the desired type enclosed in parentheses. For example, to ensure that floating-point rather than integer arithmetic is used, it may be desirable to cast an integer variable to a float in an arithmetic expression. In this case, f is assigned the value 0 while g is assigned 0.5:
int a = 1,
b = 2;
float f,g;
f = a / b;
g = (float) a / b;
The cast operator has higher precedence than arithmetic operators, so the value of 'a' is converted to a float before the division takes place.
In TC and C++ casts are often used to inform the compiler of the class of an object